package com.khotyn.heresy.exception;

import org.springframework.web.servlet.ModelAndView;

import com.khotyn.heresy.bean.HeresyErrorMessage;

/**
 * Super class of all the parameter exceptions in heresy.
 * 
 * @author khotyn
 * 
 */
public abstract class IllegalParamException extends Exception {

	private static final long serialVersionUID = -2135413554828968574L;
	private HeresyErrorMessage errorMessage;
	private ModelAndView errorModel = new ModelAndView("message", "message", errorMessage);

	public IllegalParamException(HeresyErrorMessage errorMessage) {
		super();
		setErrorMessage(errorMessage);
	}

	public IllegalParamException(ModelAndView errorModel, HeresyErrorMessage errorMessage) {
		super();
		setErrorMessage(errorMessage);
		setErrorModel(errorModel);
	}

	public IllegalParamException(ModelAndView errorModel, String s) {
		super(s);
		setErrorModel(errorModel);
	}

	public IllegalParamException(ModelAndView errorModel, Throwable cause) {
		super(cause);
		setErrorModel(errorModel);
	}

	public IllegalParamException(ModelAndView errorModel, String message, Throwable cause) {
		super(message, cause);
		setErrorModel(errorModel);
	}

	public void setErrorModel(ModelAndView errorModel) {
		this.errorModel = errorModel;
	}

	public ModelAndView getErrorModel() {
		return errorModel;
	}

	public void setErrorMessage(HeresyErrorMessage errorMessage) {
		this.errorMessage = errorMessage;
	}

	public HeresyErrorMessage getErrorMessage() {
		return errorMessage;
	}

}
